{% extends 'ApiCloud/Base/layout.common.html.twig' %}

{% block main %}
    {% include "ApiCloud/Base/inc.head.light.html.twig" with {title:"材料附件",back:1} %}
    {% include "ApiCloud/Base/inc.file.base.html.twig" with {site:""} %}
    <mu-tabs :value.sync="tab" color="amber600" indicator-color="amber600" inverse center>
        <mu-tab>查看附件</mu-tab>
        <mu-tab>添加附件</mu-tab>
    </mu-tabs>
    <div class="pad10" v-if="tab == 1">
        <mu-form ref="form" :model="en"  label-position="top" label-width="100">
            <div class="fs10 padl5 padr5">
                <mu-form-item label="附件名称" :rules="[rules.notNull]" prop="fileName">
                    <mu-text-field v-model="en.fileName" ></mu-text-field>
                </mu-form-item>
                <div class="fs10 padl5 padr5 flr">
                    <mu-form-item label="附件" :rules="[rules.notNull]" prop="file">
                        <div class="ofh">
                            <div class="flex-r flex-nowrap">
                                <mu-paper class="picCommonSize pos-r mar3" :z-depth="1"  v-for="tile, index in pics">
                                    <img class="picCommonSize" :src="tile">
                                    <div class="pos-a w100 r0 l0 b-3 flrc op6">
                                        <mu-button fab small color="black" @click="del(index)">
                                            <mu-icon  value="close"></mu-icon>
                                        </mu-button>
                                    </div>
                                </mu-paper>
                            </div>
                            <div class="">
                                <mu-button color="success" @click="selectPic()">选择照片</mu-button>
                            </div>
                        </div>
                    </mu-form-item>
                </div>
                <div class="fs8 c11 pad5 mart20">
                    <mu-button large full-width round color="primary" @click="submit()">保存提交</mu-button>
                </div>
            </div>
        </mu-form>
    </div>
    <div class="pad10" v-if="tab == 0">
        <div class="fs8 c11">
            <mu-grid-list class="gridlist-demo">
                {#<mu-sub-header>December</mu-sub-header>#}
                <mu-grid-tile  v-for="item,index in list">
                    <img :src="item.FileFile_file" @click="showPic(index)" v-if="isPic(item.FileFile_file)">
                    <img :src="picFilePath" @click="showPic(index)" v-if="!isPic(item.FileFile_file)">
                    <span slot="title">[[item.FileFile_file_Name]]</span>
                    <span slot="subTitle">by <b>[[item.User_realName]]</b></span>
                    <mu-button @click="download(item.FileFile_file,item.FileFile_file_Name)" slot="action" icon>
                        <mu-icon  value="cloud_download"></mu-icon>
                    </mu-button>
                </mu-grid-tile>
            </mu-grid-list>

        </div>
    </div>
    <mu-dialog width="90vw" dialog-class="w100 pad3"  scrollable  :open.sync="open">
        <div style="" class="pos-r">
            <div  class="pos-a r-9 t-9">
                <mu-button icon @click="closeFullscreenDialog">
                    <mu-icon value="close"></mu-icon>
                </mu-button>
            </div>
            <img :src="item" class="w100" alt="" v-for="item in atta">
        </div>
    </mu-dialog>

{% endblock %}

    {% block myJs %}

        <script type="text/javascript" src="{{ root }}/assets/oss/lib/crypto1/crypto/crypto.js"></script>
        <script type="text/javascript" src="{{ root }}/assets/oss/lib/crypto1/hmac/hmac.js"></script>
        <script type="text/javascript" src="{{ root }}/assets/oss/lib/crypto1/sha1/sha1.js"></script>
        <script type="text/javascript" src="{{ root }}/assets/oss/lib/base64.js"></script>
        {#<script type="text/javascript" src="{{ root }}/assets/oss/lib/plupload-2.1.2/js/plupload.full.min.js"></script>#}
        <script type="text/javascript" src="{{ root }}/assets/oss/uploadMy.js{{ rnd }}"></script>
    {% endblock %}
